import { createSSRApp } from "vue";
import { createI18n } from "vue-i18n"; // v9.x
import uView from "vk-uview-ui";
import App from "./App.vue";
import * as Pinia from "pinia";

// 语言包
import zh from "./locale/zh.json";
// import en from "./locale/en.json";
// import ja from "./locale/ja.json";

export const messages = {
  // en,
  zh,
  // jan,
};
let i18nConfig = {
  locale: uni.getLocale(),
  messages,
};

const i18n = createI18n(i18nConfig);
export function createApp() {
  const app = createSSRApp(App);
  app.use(Pinia.createPinia());
  app.config.globalProperties.$t = i18n.global.t

  app.use(i18n);
  // 使用 uView UI
  app.use(uView);

  return {
    app,
    Pinia,
  };
}
